import { ref, computed } from "vue";
import { defineStore } from "pinia";

export let useBStore = defineStore("b",()=>{
    let b = ref(20);
    let doubleB = computed(()=> b.value * 2);
    let tripleB = computed(()=> b.value * 3);

    let addB = ()=>{
        b.value++;
    }
    let addB_Async = ()=>{
        return new Promise((resolve)=>{
            setTimeout(() => {
                b.value++;
                resolve();
            }, 2000);
        })
    }


    return {
        b,
        doubleB,
        tripleB,
        addB,
        addB_Async
    }
})